<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/commons/inc.jsp" %>
<h3 id="navTitleId">医院信息管理</h3>
<div id="resultId" style="">

<%@include file="/commons/showmessage.jsp" %>

<form id="hospitalForm" name="hospitalForm" method="post" action="${contextPath}/group/group.action?method=saveEditHospital">
<table>
	<tr>
		<td class="tdLabel"><label class="label">单位名称:</label></td>
		<td><input type="text" name="user.danwei" id="user.danwei" value="${user.danwei}" dataType="Noempty" msg="请输入单位名称"></td>
		<td class="tdLabel"><label class="label">单位编号:</label></td>
		<td><input type="text" name="user.userid" id="user.userid" readonly="true" value="${user.userid}"></td>
	</tr>
	<tr>
		<td class="tdLabel"><label class="label">联系人:</label></td>
		<td><input type="text" name="user.relateperson" id="user.relateperson" value="${user.relateperson}"></td>
		<td class="tdLabel"><label class="label">电话:</label></td>
		<td><input type="text" name="user.phonenumber" id="user.phonenumber" value="${user.phonenumber}"></td>
	</tr>
	<tr>
		<td class="tdLabel"><label class="label">地址:</label></td>
		<td colspan="3"><input type="text" name="user.address" id="user.address" size="60" value="${user.address}"></td>
	</tr>	
	<tr><td colspan="4"><input type="button" onclick="saveEdit('save');" value="保存"></td></tr>
</table>
</form>
<h3 id="navTitleId">课题组列表 <input type="button" value="新增课题组" onClick="javascript:newGroup();"/></h3>
<form id="SearchForm" name="SearchForm" method="post" action="${contextPath}/group/group.action">
<input type="hidden" name="method" value="query" id="method"/>
<input type="hidden" name="orderCol" id="orderCol"/>

<table border="0" cellspacing="1" cellpadding="0" class="formTable" width="100%" >
      <thead>
        <tr>
          <td width="100"  align="center" class="form-sort-th" onclick="tbSort('groupbh');">课题名称</td>
          <td width="100"  align="center" class="form-th">随访周期</td>
          <td width="60"  align="center" class="form-th">患者人数</td>
          <td width="60"  align="center" class="form-sort-th" onclick="tbSort('groupstatus');">状态</td>
          <td width="40"  align="center" class="form-th">科研组操作</td>
        </tr>
      </thead>
      <tbody>
       <s:iterator value="#request.result" >
       <tr>
         <td align="center" class="form-td">${groupbh}-${groupname}</td>
         <td align="center" class="form-td">
         <s:if test="timelong!=null && timelong!=''">
	         ${timelong}<s:if test="timetype==0">日</s:if>
	         			<s:elseif test="timetype==1">个月</s:elseif>
	         			<s:elseif test="timetype==2">年</s:elseif></s:if>
         <s:else>无</s:else></td>
         <td align="center" class="form-td">${patientcount}</td>
         <td align="center" class="form-td">
          	 <s:if test="groupstatus==0"><font color="#8F4586">进行中</font></s:if>
	         <s:elseif test="groupstatus==1"><font color="red">结束</font></s:elseif></td>
	     <td align="center" class="form-td">
	     	<a href="javascript:void(0);" onclick="doEdit(${researchgroupid}); return false">编辑</a>
	     	| <a href="javascript:void(0);" onclick="enterPatient(${researchgroupid}); return false">进入患者列表</a></td>
       </tr>
       </s:iterator>
      </tbody>
    </table>
</form> 
<div style="display:block; height:10px;"></div>
</div>


<script>
function doEdit(id){
	location.href="${contextPath}/group/group.action?method=editGroup&researchgroupid="+id;
}
function enterPatient(id){
	location.href="${contextPath}/patient/patient.action?method=query&researchgroupid="+id;
}
function newGroup(){
	location.href="${contextPath}/group/group.action?method=insertNewGroup";
}
function saveEdit(type){
	 if(type=='save'){
		 if(!Validator.Validate($('hospitalForm'),3)){
			 return;
		 }	
		$('hospitalForm').submit();
	  }
}
</script>